<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>发布文章</title>

    <!-- bootstrap styles -->
    <link th:href="@{css/bootstrap.css}" th:rel="stylesheet" media="all" />
    <!-- font-awesome styles -->
    <link th:href="@{css/font-awesome.css}" th:rel="stylesheet" media="all"/>
    <!-- google styles -->
    <link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" />
    <link th:href="@{css/common.css}" th:rel="stylesheet"/>
    <link th:href="@{css/editor.css}" th:rel="stylesheet"/>

    <script th:src="@{js/jquery.min.js}"></script>
    <script th:src="@{js/bootstrap-3.1.1.min.js}"></script>
    <script th:src="@{ckeditor/ckeditor.js}"></script>
    <script th:src="@{ckfinder/ckfinder.js}"></script>
    <script th:src="@{js/editor.js}"></script>

</head>
<body class="editor">
    <div id="page">
        <div id="header" data-stellar-background-ratio="0.5">
            <nav role="navigation">
                <ul>
                    <li><a th:href="index"><i class="fa fa-home"></i></a></li>
                </ul>
            </nav>
        </div>
        <div id="main">
            <div class="wrapper">
                <div th:switch="${#httpServletRequest.getParameter('op')}" class="padding">
                    <form th:case="'modify'" th:action="@{do_modify_article(aid=${session.article.aid})}" enctype="multipart/form-data" method="post" dir="ltr" lang="zh-cn">
                        <div class="row">
                            <select name="tag">
                                <option value="1" th:selected="${session.tag}=='Java语言基础'?true:false">Java语言基础</option>
                                <option value="2" th:selected="${session.tag}=='经典算法'?true:false">经典算法</option>
                                <option value="3" th:selected="${session.tag}=='数据库'?true:false">数据库</option>
                                <option value="4" th:selected="${session.tag}=='设计模式'?true:false">设计模式</option>
                                <option value="5" th:selected="${session.tag}=='Web'?true:false">Web</option>
                            </select>
                            <input type="text" name="articleName" placeholder="文章标题" disabled="disabled" th:value="${session.article.name}" />
                            <input type="submit" class="btn btn-success release" value="提交修改" />
                        </div>
                        <div class="row">
                            <input type="text" name="description" placeholder="描述" th:value="${session.article.description}" />
                            <input type="hidden" name="articleId" th:value="${session.article.aid}" />
                        </div>
                        <div class="row">
                            <textarea id="article_content" name="articleContent" rows="10" cols="80" title="请输入文章正文">
                                [[${session.article.content}]]
                            </textarea>
                        </div>
                    </form>
                    <form th:case="*" th:action="@{create_article}" enctype="multipart/form-data" method="post" dir="ltr" lang="zh-cn">
                        <div class="row">
                            <select name="tag">
                                <option value="1">Java语言基础</option>
                                <option value="2">经典算法</option>
                                <option value="3">数据库</option>
                                <option value="4">设计模式</option>
                                <option value="5">Web</option>
                            </select>
                            <input type="text" name="articleName" placeholder="文章标题"/>
                            <input type="submit" class="btn btn-success release" value="发表文章" />
                        </div>
                        <div class="row">
                            <input type="text" name="description" placeholder="描述" />
                            <input type="hidden" name="articleId" value="0" />
                        </div>
                        <div class="row">
                            <textarea id="article_content" name="articleContent" rows="10" cols="80" title="请输入文章正文"></textarea>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</body>
</html>

